<extend name="Public/base" />

<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="{:U('Config/index')}"
				class="current">{$meta_title}</a> <a class="current">{$meta_title_c}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<form action="" method="post" class="form-horizontal">
						<div class="control-group">
							<label class="control-label">配置标识 :</label>
							<div class="controls">
								<input type="text" class="ui-wizard-content span4"
									placeholder="WEB_SITE_TITLE" name="name" />
									<br><span class="help-block blue mt10">（用于C函数调用，只能使用英文且不能重复）</span>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">配置标题 :</label>
							<div class="controls">
								<input type="text" class="ui-wizard-content span4"
									placeholder="网站标题" name="title" />
									<br><span class="help-block blue mt10">（用于后台显示的配置标题）</span>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">排序 :</label>
							<div class="controls">
								<input type="text" class="ui-wizard-content span2"
									placeholder="例如：0" name="sort" />
							</div>
						</div>
						<div class="control-group" style="height:50px;">
							<label class="control-label">配置类型 :</label>
							<div class="controls">
								<select class="form-control span3" name="type">
									<volist name="Think.config.CONFIG_TYPE_LIST" id="type">
										<option value="{$key}">{$type}</option>
									</volist>
								</select>
							</div>
						</div>
						<div class="control-group" style="height:50px;">
							<label class="control-label">配置分组 :</label>
							<div class="controls">
								<select class="form-control span3" name="group">
									<option value="0">不分组</option>
									<volist name="Think.config.CONFIG_GROUP_LIST" id="group">
										<option value="{$key}">{$group}</option>
									</volist>
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">配置值 :</label>
							<div class="controls">
								<textarea class="ui-wizard-content span5" placeholder="配置值"
									style="resize: none; height: 100px;" name="value"></textarea>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">配置项 :</label>
							<div class="controls">
								<textarea class="ui-wizard-content span5" placeholder="如果是枚举型 需要配置该项"
									style="resize: none; height: 100px;" name="extra"></textarea>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">说明 :</label>
							<div class="controls">
								<textarea class="ui-wizard-content span5" placeholder="配置详细说明"
									style="resize: none; height: 100px;"
									name="remark"></textarea>
							</div>
						</div>
						<div class="form-actions">
							<button type="button" class="btn btn-success" id="submit">确 定</button>&nbsp;<button type="button" class="btn btn-danger" onclick="javascript:history.back(-1);return false;">返 回</button>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#submit").click(function(){
		//锁定提交按钮
		$(this).attr('disabled',true);
		var self = $('form');
		$.post("{:U('Config/add')}", self.serialize(), call_back, "json");
		return false;
		/**
		 * @todo 接收登录返回值
		 */
		function call_back(data){
			if(data.status == 1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
					window.location.href = data.url;
				},1000);
			} else {
				tke_alert(data.info,'alert-error');
				$("#submit").attr('disabled',false);
			}
		}
	});
});
highlight_subnav("{:U('Config/index')}");
</script>
</block>
